/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entitybean;

import java.io.Serializable;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.transaction.UserTransaction;

/**
 *
 * @author ShahanThai
 */
@Entity
@Table(name = "Songs", catalog = "SharingMusic", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "Songs.findAll", query = "SELECT s FROM Songs s"),
    @NamedQuery(name = "Songs.findBySongID", query = "SELECT s FROM Songs s WHERE s.songID = :songID"),
    @NamedQuery(name = "Songs.findByName", query = "SELECT s FROM Songs s WHERE s.name = :name"),
    @NamedQuery(name = "Songs.findByLyrics", query = "SELECT s FROM Songs s WHERE s.lyrics = :lyrics"),
    @NamedQuery(name = "Songs.findByPublishYear", query = "SELECT s FROM Songs s WHERE s.publishYear = :publishYear"),
    @NamedQuery(name = "Songs.findByListened", query = "SELECT s FROM Songs s WHERE s.listened = :listened"),
    @NamedQuery(name = "Songs.findByDownloaded", query = "SELECT s FROM Songs s WHERE s.downloaded = :downloaded"),
    @NamedQuery(name = "Songs.findByNo", query = "SELECT s FROM Songs s WHERE s.no = :no"),
    @NamedQuery(name = "Songs.findByIsSong", query = "SELECT s FROM Songs s WHERE s.isSong = :isSong"),
    @NamedQuery(name = "Songs.findByThumbnail", query = "SELECT s FROM Songs s WHERE s.thumbnail = :thumbnail")})
public class Songs implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue
    @Basic(optional = false)
    @Column(name = "SongID", nullable = false)
    private int songID;
    @Basic(optional = false)
    @Column(name = "Name", nullable = false, length = 50)
    private String name;
    @Basic(optional = false)
    @Column(name = "Lyrics", nullable = false, length = 1073741823)
    private String lyrics;
    @Basic(optional = false)
    @Column(name = "PublishYear", nullable = false)
    private int publishYear;
    @Basic(optional = false)
    @Column(name = "Listened", nullable = false)
    private int listened;
    @Basic(optional = false)
    @Column(name = "Downloaded", nullable = false)
    private int downloaded;
    @Column(name = "No")
    private Integer no;
    @Basic(optional = false)
    @Column(name = "isSong", nullable = false)
    private boolean isSong;
    @Lob
    @Column(name = "L1", length = 2147483647)
    private String l1;
    @Lob
    @Column(name = "L2", length = 2147483647)
    private String l2;
    @Lob
    @Column(name = "L3", length = 2147483647)
    private String l3;
    @Lob
    @Column(name = "L4", length = 2147483647)
    private String l4;
    @Lob
    @Column(name = "D1", length = 2147483647)
    private String d1;
    @Lob
    @Column(name = "D2", length = 2147483647)
    private String d2;
    @Lob
    @Column(name = "D3", length = 2147483647)
    private String d3;
    @Lob
    @Column(name = "D4", length = 2147483647)
    private String d4;
    @Column(name = "Thumbnail", length = 1073741823)
    private String thumbnail;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "songs")
    private List<Comments> commentsList;
    @JoinColumn(name = "ProducerID", referencedColumnName = "ProducerID")
    @ManyToOne
    private Producers producers;
    @JoinColumn(name = "MusicianID", referencedColumnName = "MusicianID")
    @ManyToOne
    private Musicians musicians;
    @JoinColumn(name = "GenreID", referencedColumnName = "GenreID")
    @ManyToOne
    private Genres genres;
    @JoinColumn(name = "CountryID", referencedColumnName = "CountryID")
    @ManyToOne
    private Country country;
    @JoinColumn(name = "ArtistID", referencedColumnName = "ArtistID")
    @ManyToOne
    private Artists artists;
    @JoinColumn(name = "AlbumID", referencedColumnName = "AlbumID")
    @ManyToOne
    private Albums albums;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "songs")
    private List<Upload> uploadList;

    public Songs() {
    }

    public Songs(int songID) {
        this.songID = songID;
    }

    public Songs(int songID, String name, String lyrics, int publishYear, int listened, int downloaded, boolean isSong) {
        this.songID = songID;
        this.name = name;
        this.lyrics = lyrics;
        this.publishYear = publishYear;
        this.listened = listened;
        this.downloaded = downloaded;
        this.isSong = isSong;
    }

    public Songs(String name, Artists artist, Albums album, Genres genre, Producers producer, String lyric, Country country, Musicians musician, int year, int listened, int download, int no, boolean isSong, String l1, String l2, String l3, String l4, String d1, String d2, String d3, String d4, String thumbnail) {
        this.name = name;
        this.artists = artist;
        this.albums = album;
        this.genres = genre;
        this.producers = producer;
        this.country = country;
        this.musicians = musician;
        this.lyrics = lyric;
        this.publishYear = year;
        this.listened = listened;
        this.downloaded = download;
        this.no = no;
        this.l1 = l1;
        this.l2 = l2;
        this.l3 = l3;
        this.l4 = l4;
        this.d1 = d1;
        this.d2 = d2;
        this.d3 = d3;
        this.d4 = d4;
        this.thumbnail = thumbnail;
        this.isSong = isSong;
    }

    public int getSongID() {
        return songID;
    }

    public void setSongID(int songID) {
        this.songID = songID;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getLyrics() {
        return lyrics;
    }

    public void setLyrics(String lyrics) {
        this.lyrics = lyrics;
    }

    public int getPublishYear() {
        return publishYear;
    }

    public void setPublishYear(int publishYear) {
        this.publishYear = publishYear;
    }

    public int getListened() {
        return listened;
    }

    public void setListened(int listened) {
        this.listened = listened;
    }

    public int getDownloaded() {
        return downloaded;
    }

    public void setDownloaded(int downloaded) {
        this.downloaded = downloaded;
    }

    public int getNo() {
        return no;
    }

    public void setNo(int no) {
        this.no = no;
    }

    public boolean getIsSong() {
        return isSong;
    }

    public void setIsSong(boolean isSong) {
        this.isSong = isSong;
    }

    public String getL1() {
        return l1;
    }

    public void setL1(String l1) {
        this.l1 = l1;
    }

    public String getL2() {
        return l2;
    }

    public void setL2(String l2) {
        this.l2 = l2;
    }

    public String getL3() {
        return l3;
    }

    public void setL3(String l3) {
        this.l3 = l3;
    }

    public String getL4() {
        return l4;
    }

    public void setL4(String l4) {
        this.l4 = l4;
    }

    public String getD1() {
        return d1;
    }

    public void setD1(String d1) {
        this.d1 = d1;
    }

    public String getD2() {
        return d2;
    }

    public void setD2(String d2) {
        this.d2 = d2;
    }

    public String getD3() {
        return d3;
    }

    public void setD3(String d3) {
        this.d3 = d3;
    }

    public String getD4() {
        return d4;
    }

    public void setD4(String d4) {
        this.d4 = d4;
    }

    public String getThumbnail() {
        return thumbnail;
    }

    public void setThumbnail(String thumbnail) {
        this.thumbnail = thumbnail;
    }

    public List<Comments> getCommentsList() {
        return commentsList;
    }

    public void setCommentsList(List<Comments> commentsList) {
        this.commentsList = commentsList;
    }

    public Producers getProducers() {
        return producers;
    }

    public void setProducers(Producers producers) {
        this.producers = producers;
    }

    public Musicians getMusicians() {
        return musicians;
    }

    public void setMusicians(Musicians musicians) {
        this.musicians = musicians;
    }

    public Genres getGenres() {
        return genres;
    }

    public void setGenres(Genres genres) {
        this.genres = genres;
    }

    public Country getCountry() {
        return country;
    }

    public void setCountry(Country country) {
        this.country = country;
    }

    public Artists getArtists() {
        return artists;
    }

    public void setArtists(Artists artists) {
        this.artists = artists;
    }

    public Albums getAlbums() {
        return albums;
    }

    public void setAlbums(Albums albums) {
        this.albums = albums;
    }

    public List<Upload> getUploadList() {
        return uploadList;
    }

    public void setUploadList(List<Upload> uploadList) {
        this.uploadList = uploadList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash = this.songID;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Songs)) {
            return false;
        }
        Songs other = (Songs) object;
        if (this.songID != other.songID) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entitybean.Songs[songID=" + songID + "]";
    }
}
